/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package devbureau.fstore.util;

import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;

/**
 *
 * @author SSheypak
 */
public class ExcelHelper {
    /**Routine for clean output. Do not print null to invoice
     * @param str is a String you want to print to invoice
     * @return str or "" if null - just empty string.
     */
    public static String emptyStringOrValue(String str){
        return (str == null || str.isEmpty())? "" : str;
    }

    /**Wraps String to HSSFRichTextString
     * @param str is a str to convert
     * @return new HSSFRichTextString object
     */
     public static HSSFRichTextString convert(String str){
        HSSFRichTextString res = new HSSFRichTextString(str);
        return res;
    }

     public static void setBorders(HSSFCellStyle style, short left, short right, short top, short bottom) {
        style.setBorderTop(top);
        style.setBorderBottom(bottom);
        style.setBorderLeft(left);
        style.setBorderRight(right);
    }
}
